bitkeeper revision 1.136.2.1 (3e7467e94A_D2ld8HeK-7FkHLGPCjg)
authorrn@wyvis.research.intel-research.net <rn@wyvis.research.intel-research.net>
Sun, 16 Mar 2003 12:02:49 +0000 (12:02 +0000)
committerrn@wyvis.research.intel-research.net <rn@wyvis.research.intel-research.net>
Sun, 16 Mar 2003 12:02:49 +0000 (12:02 +0000)
minor tweak to schedule()

xen/common/schedule.c

index 3ef29e3c5cb24dd764e7b159d4159ac75b91364b..5a9a6c96112278115361452ada29d50063b44cba 100644 (file)
@@ -249,11 +249,16 @@ asmlinkage void schedule(void)
  need_resched_back:
     perfc_incrc(sched_run2);
 
-    now = NOW();
-    next = NULL;
+
     prev = current;
+    next = NULL;
+
     this_cpu = prev->processor;
 
+    spin_lock_irq(&schedule_data[this_cpu].lock);
+
+    now = NOW();
+
     /* remove timer  */
     rem_ac_timer(&schedule_data[this_cpu].s_timer);
 
@@ -261,11 +266,10 @@ asmlinkage void schedule(void)
      * deschedule the current domain
      */
 
-    spin_lock_irq(&schedule_data[this_cpu].lock);
-
     ASSERT(!in_interrupt());
     ASSERT(__task_on_runqueue(prev));
 
+
     if (is_idle_task(prev)) 
         goto deschedule_done;
 
@@ -363,14 +367,14 @@ asmlinkage void schedule(void)
      * work out how long 'next' can run till its evt is greater than
      * 'next_prime's evt. Taking context switch allowance into account.
      */
-    ASSERT(next_prime->evt > next->evt);
+    ASSERT(next_prime->evt >= next->evt);
     r_time = ((next_prime->evt - next->evt)/next->mcu_advance) + ctx_allow;
 
  sched_done:
     ASSERT(r_time != 0);
-    ASSERT(r_time > ctx_allow);
+    ASSERT(r_time >= ctx_allow);
 
-#if 0
+#ifndef NDEBUG
     if ( (r_time==0) || (r_time < ctx_allow)) {
         printk("[%02d]: %lx\n", this_cpu, r_time);
         dump_rqueue(&schedule_data[this_cpu].runqueue, "foo");
@@ -389,7 +393,8 @@ asmlinkage void schedule(void)
  timer_redo:
     schedule_data[this_cpu].s_timer.expires  = now + r_time;
     if (add_ac_timer(&schedule_data[this_cpu].s_timer) == 1) {
-        printk("SCHED[%02d]: Shit this shouldn't happen\n", this_cpu);
+        printk("SCHED[%02d]: Shit this shouldn't happen r_time=%lu\n", 
+               this_cpu, r_time);
         now = NOW();
         goto timer_redo;
     }